//
//  OneImageTableViewCell.m
//  11_Work
//
//  Created by dllo on 16/7/27.
//  Copyright © 2016年 yh. All rights reserved.
//

#import "OneImageTableViewCell.h"
#import "FirstImage.h"

@interface OneImageTableViewCell ()

@property (nonatomic, strong) UIImageView *oneImageView;
@property (nonatomic, strong) UILabel *titleLabel;


@end

@implementation OneImageTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _oneImageView = [[UIImageView alloc] init];
        _oneImageView.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_oneImageView];
        
        _titleLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_titleLabel];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    _oneImageView.frame = CGRectMake(5, 5, self.contentView.frame.size.width / 3 - 5, self.contentView.frame.size.height - 10);
    _titleLabel.frame = CGRectMake(self.contentView.frame.size.width / 3 + 10, 20, self.contentView.frame.size.width / 3 * 2, 30);
}

- (void)setFirstImage:(FirstImage *)firstImage {
    _firstImage = firstImage;
    _titleLabel.text = firstImage.title;
    _oneImageView.image = [UIImage imageNamed:firstImage.pic];
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
